﻿// SLTool.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <stdio.h>
#include "SLT_thread_pool.h"

class threadpootTestTask :public slt_thread_task
{
	public:
		~threadpootTestTask()
		{
			printf("destory task:%d\n", m_id);
		}
		virtual void onRun()
		{
			printf("pool task : id:%d,tid:%d\n", m_id, std::this_thread::get_id());
		}
		int  m_id = 0;
};

int tool_threadpool_test_main()
{
	slt_thread_pool* pool = new slt_thread_pool();
	pool->init(2);

	threadpootTestTask* ptask = new threadpootTestTask();
	ptask->m_id = 0;
	pool->post_task(ptask);

	ptask = new threadpootTestTask();
	ptask->m_id = 1;
	pool->post_task(ptask);

	ptask = new threadpootTestTask();
	ptask->m_id = 2;
	pool->post_task(ptask);


	return 0;
}

